#!/bin/bash

echo "🔧 安装GORM代码生成工具依赖..."

# 进入server目录
cd "$(dirname "$0")/.."

# 添加GORM Gen依赖
echo "📦 添加gorm.io/gen依赖..."
go get gorm.io/gen@latest

# 添加YAML解析依赖
echo "📦 添加gopkg.in/yaml.v2依赖..."
go get gopkg.in/yaml.v2

# 整理依赖
echo "🧹 整理go.mod..."
go mod tidy

echo "✅ 依赖安装完成！"
echo ""
echo "现在您可以使用以下命令生成GORM模型："
echo "  cd server"
echo "  go run tools/simple_gen.go          # 简单生成"
echo "  go run tools/gen.go                 # 高级生成"
echo "  go run tools/advanced_gen.go        # 配置文件生成"